﻿using System;
using System.Threading.Tasks;
using System.Windows;
using Red.Controls.ViewModels;

namespace Red.Controls.Diagrams.Actions.InteropActions
{
    public class AddNodeAction : InteropActionBase
    {
        #region C-tor

        public AddNodeAction ( DataItem parentObject, string className, Point position, DiagramViewModel viewModel, Func<string, Task> nodeCreator )
        {
            _nodeData = new ActionNodeData
            {
                ClassName = className,
                Position = position,
                NodeID = string.Empty,
            };
            _parentObject = parentObject;
            _viewModel = viewModel;
            _nodeCreator = nodeCreator;
        }

        #endregion C-tor

        #region Public methods

        public async Task Execute()
        {
            await CreateNodeAsync( _nodeData, _parentObject );
        }

        #endregion Public methods
    }
}
